<template>
<el-form :model="editForm"  label-width="120px" :rules="editFormRules" ref="editFormRef">
    <el-form-item label="公司ID" prop="branchId">
        <el-input  v-model="editForm.branchId" placeholder="公司ID" :maxlength="50" @change="editSomeFields(editForm,'branchId',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="等级ID" prop="ilvlId">
        <el-input  v-model="editForm.ilvlId" placeholder="等级ID" :maxlength="50" @change="editSomeFields(editForm,'ilvlId',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="等级名称" prop="ilvlName">
        <el-input  v-model="editForm.ilvlName" placeholder="等级名称" :maxlength="50" @change="editSomeFields(editForm,'ilvlName',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="等级描述" prop="idesc">
        <el-input  v-model="editForm.idesc" placeholder="等级描述" :maxlength="1000" @change="editSomeFields(editForm,'idesc',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="1-粉丝,2-" prop="ilevel">
        <el-input-number  v-model="editForm.ilevel" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="权益，折扣" prop="discount">
        <el-input-number  v-model="editForm.discount" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="等级状态" prop="istatus">
        <el-input  v-model="editForm.istatus" placeholder="等级状态" :maxlength="1" @change="editSomeFields(editForm,'istatus',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="创建时间" prop="ctime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.ctime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="更新时间" prop="ltime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.ltime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="等级图标url" prop="picUrl">
        <el-input  v-model="editForm.picUrl" placeholder="等级图标url" :maxlength="255" @change="editSomeFields(editForm,'picUrl',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="是否付费获取权益" prop="isFree">
        <el-input  v-model="editForm.isFree" placeholder="是否付费获取权益" :maxlength="1" @change="editSomeFields(editForm,'isFree',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="续会时间叠加规则：1.有效期日期后叠加续会时间" prop="rtimeRule">
        <el-input  v-model="editForm.rtimeRule" placeholder="续会时间叠加规则：1.有效期日期后叠加续会时间" :maxlength="1" @change="editSomeFields(editForm,'rtimeRule',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="续会时间类型：1.天数" prop="rtimeType">
        <el-input  v-model="editForm.rtimeType" placeholder="续会时间类型：1.天数" :maxlength="1" @change="editSomeFields(editForm,'rtimeType',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="下次续会时间yyyy-MM-dd型" prop="rtime">
        <el-input  v-model="editForm.rtime" placeholder="下次续会时间yyyy-MM-dd型" :maxlength="10" @change="editSomeFields(editForm,'rtime',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="权益分类" prop="itype">
        <el-input  v-model="editForm.itype" placeholder="权益分类" :maxlength="1" @change="editSomeFields(editForm,'itype',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="商户编号" prop="shopId">
        <el-input  v-model="editForm.shopId" placeholder="商户编号" :maxlength="20" @change="editSomeFields(editForm,'shopId',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当前流程实例编号" prop="instId">
        <el-input  v-model="editForm.instId" placeholder="当前流程实例编号" :maxlength="50" @change="editSomeFields(editForm,'instId',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当前流程状态，0初始1审批中2审批通过3审批不通过4流程取消或者删除" prop="flowState">
        <el-input  v-model="editForm.flowState" placeholder="当前流程状态，0初始1审批中2审批通过3审批不通过4流程取消或者删除" :maxlength="1" @change="editSomeFields(editForm,'flowState',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="单个任务最大金额（任务型用户才有）0代表不限制" prop="smaxAt">
        <el-input  v-model="editForm.smaxAt" placeholder="单个任务最大金额（任务型用户才有）0代表不限制" :maxlength="10" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="累计接单金额（任务型用户才有）0代表不限制" prop="totalAt">
        <el-input  v-model="editForm.totalAt" placeholder="累计接单金额（任务型用户才有）0代表不限制" :maxlength="20" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="适用会员类型（2商户型、1普通型、3任务型）" prop="mtype">
        <el-input  v-model="editForm.mtype" placeholder="适用会员类型（2商户型、1普通型、3任务型）" :maxlength="10" @change="editSomeFields(editForm,'mtype',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="累计经验值0代表不限制" prop="totalExp">
        <el-input  v-model="editForm.totalExp" placeholder="累计经验值0代表不限制" :maxlength="20" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="单个任务最大经验值0代表不限制" prop="smaxExp">
        <el-input  v-model="editForm.smaxExp" placeholder="单个任务最大经验值0代表不限制" :maxlength="20" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="投标次数上限" prop="bids">
        <el-input-number  v-model="editForm.bids" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="服务费率0-100之间" prop="sfeeRate">
        <el-input-number  v-model="editForm.sfeeRate" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="覆盖上一条的等级编号，即变成当前等级之前的等级编号" prop="idBak">
        <el-input  v-model="editForm.idBak" placeholder="覆盖上一条的等级编号，即变成当前等级之前的等级编号" :maxlength="50" @change="editSomeFields(editForm,'idBak',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="累计完成工作量" prop="ctotalExp">
        <el-input  v-model="editForm.ctotalExp" placeholder="累计完成工作量" :maxlength="20" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当前累计完成金额" prop="ctotalAt">
        <el-input  v-model="editForm.ctotalAt" placeholder="当前累计完成金额" :maxlength="50" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="累计投标总数" prop="ctotalBids">
        <el-input-number  v-model="editForm.ctotalBids" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="月均费用" prop="mfee">
        <el-input  v-model="editForm.mfee" placeholder="月均费用" :maxlength="20" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="最大人员数" prop="maxUsers">
        <el-input-number  v-model="editForm.maxUsers" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当前人员数" prop="currUsers">
        <el-input-number  v-model="editForm.currUsers" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="产品模块下次续费截止时间yyyy-MM-dd类型" prop="maxRtime">
        <el-input  v-model="editForm.maxRtime" placeholder="产品模块下次续费截止时间yyyy-MM-dd类型" :maxlength="10" @change="editSomeFields(editForm,'maxRtime',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="产品版本0免费版1企业版" prop="mver">
        <el-input  v-model="editForm.mver" placeholder="产品版本0免费版1企业版" :maxlength="1" @change="editSomeFields(editForm,'mver',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="诚信保障金等级金银铜，1-金，2-银，3-铜,0-初始，过期后归0" prop="guardId">
        <el-input  v-model="editForm.guardId" placeholder="诚信保障金等级金银铜，1-金，2-银，3-铜,0-初始，过期后归0" :maxlength="1" @change="editSomeFields(editForm,'guardId',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="累计服务次数" prop="srvTimes">
        <el-input-number  v-model="editForm.srvTimes" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="服务保障名称" prop="guardName">
        <el-input  v-model="editForm.guardName" placeholder="服务保障名称" :maxlength="255" @change="editSomeFields(editForm,'guardName',$event)" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="服务保障下次续费时间" prop="guardRtime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.guardRtime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当月投标数" prop="cmonthBids">
        <el-input-number  v-model="editForm.cmonthBids" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当月金额" prop="cmonthAt">
        <el-input  v-model="editForm.cmonthAt" placeholder="当月金额" :maxlength="10" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当月经验值" prop="cmonthExp">
        <el-input-number  v-model="editForm.cmonthExp" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="当前收款总额" prop="ctotalReceiveAt">
        <el-input  v-model="editForm.ctotalReceiveAt" placeholder="当前收款总额" :maxlength="10" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="六个月经验分" prop="csixExp">
        <el-input-number  v-model="editForm.csixExp" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="六个月金额" prop="csixAt">
        <el-input  v-model="editForm.csixAt" placeholder="六个月金额" :maxlength="10" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="六个月投标次数" prop="csixBids">
        <el-input-number  v-model="editForm.csixBids" :min="0" :max="200" :precision="0" :disabled="  disField"/>
    </el-form-item>
    <el-form-item label="清除时间" prop="clearTime">
        <el-date-picker type="date" placeholder="选择日期"  v-model="editForm.clearTime"  value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd" :disabled="  disField"/>
    </el-form-item>
</el-form>
<el-row v-if="showBtn!==false" class="footer">
    <el-button @click="close" icon="close">关闭</el-button>
    <el-button icon="submit" v-if="currOpType=='add'" v-loading="load.edit" type="primary" @click="saveSubmit" :disabled="disBtn('addBtn') || !checkBtnQx('addBtn',menuDefId) || load.edit">提交</el-button>
</el-row>
</template>

<script>
import * as BranchInterestsApi from '@/api/mdp/sys/branchInterests';
import { MdpFormMixin } from '@/components/mdp-ui/mixin/MdpFormMixin.js';
import { mapState } from 'pinia'
import { useUserStore } from '@/store/modules/user'

export default {
    name:'BranchInterestsForm',
    mixins:[MdpFormMixin],
    components: {
    },
    computed: {
        ...mapState(useUserStore,['userInfo'])
    },
    props:{
    },
    watch: {
    },
    data() {
        return {
            menuDefId:'',//menu_def.id 菜单表菜单编号，用于按钮权限判断
            pkNames:["branchId"],//表格主键的java属性名称，驼峰命名，默认为id,支持多主键
            
            editFormRules: {
                branchId:[
                //{ required: true, message: '此项必填', trigger: 'change' },
                //{ min: 1,max: 200, message: '长度在1到200之间', trigger: 'change'}
                ]
            },
            editForm: {
                branchId:'',ilvlId:'',ilvlName:'',idesc:'',ilevel:'',discount:'',istatus:'',ctime:'',ltime:'',picUrl:'',isFree:'',rtimeRule:'',rtimeType:'',rtime:'',itype:'',shopId:'',instId:'',flowState:'',smaxAt:'',totalAt:'',mtype:'',totalExp:'',smaxExp:'',bids:'',sfeeRate:'',idBak:'',ctotalExp:'',ctotalAt:'',ctotalBids:'',mfee:'',maxUsers:'',currUsers:'',maxRtime:'',mver:'',guardId:'',srvTimes:'',guardName:'',guardRtime:'',cmonthBids:'',cmonthAt:'',cmonthExp:'',ctotalReceiveAt:'',csixExp:'',csixAt:'',csixBids:'',clearTime:''
            },
            //增删改查(含批量)接口
            apis:{
                queryById: BranchInterestsApi.queryBranchInterestsById,
                add: BranchInterestsApi.addBranchInterests,
                edit: BranchInterestsApi.editBranchInterests,
                editSomeFields: BranchInterestsApi.editSomeFieldsBranchInterests
            },
        }
    },
    methods: {
         //由组件扩展添加其它的初始页面的逻辑(mounted+onOpen都会调用此函数，建议只添加公共逻辑)
         initCurrData(){

         },
        /**
         * 检查参数是否满足调用后台接口的条件
         * @returns true / false
         */
        preParamCheck(params){
            return true;
        },
        /**
         * 对修改的字段进行判断，返回false ,将取消更新数据库,由组件扩展
         * @param {*} row 当前选中的行
         * @param {*} fieldName 修改的字段名
         * @param {*} $event 修改后的值
         * @param {*} params 将要提交服务器的参数
         * @returns true/false 返回false ,将取消更新数据库
         */
        editSomeFieldsCheck(row,fieldName,$event,params){
            if(this.editable==false){
                return false;
            }
            params[fieldName]=$event
            return true;
        },
    },
    mounted() {

    }
}

</script>

<style scoped>

</style>